package com.zxing.practice.controller.system;

import com.zxing.practice.service.system.LoginService;
import com.zxing.practice.vo.system.LoginBody;
import com.zxing.practice.config.vo.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginBody loginBody) {
        String token = loginService.login(loginBody);
        token = "Bearer " + token;
        return AjaxResult.success("登录成功", token);
    }
}